
public class GoalPopulation {
	int[][] goal;
	public static String name;
	
	public GoalPopulation(Integer x, Integer y)
	{
		int xStart = (x/2)-6;
		int xEnd = (x/2)+6;
		goal = new int[x][y];
		for (int j=0;j<y;j++)
		{
			for(int i=xStart;i<xEnd;i++)
			{
				goal[i][j] = 1;
			}
		}
	}
	
	public GoalPopulation(Integer x, Integer y, DisplayGrid goalGrid,boolean checker)
	{	
		name = new String("Big X");
		goal = new int[x][y];
		for (int j=0;j<y;j=j+5)
		{
			for(int i=0;i<x;i=i+5)
			{
				goal[i][j] = 1;
				goal[i][j+4] = 1;
				goal[i+1][j+1]=1;
				goal[i+1][j+3] = 1;
				goal[i+2][j+2] = 1;
				goal[i+3][j+3] =1;
				goal[i+3][j+1] =1;
				goal[i+4][j] = 1;
				goal[i+4][j+4] = 1;
			}
		}
		
		/**
		name = new String("Modified Checkerboard 2 blocks high, one wide - Try with 150 GOL");
		boolean even=checker;
		goal = new int[x][y];
		for (int j=0;j<y;j=j+2)
		{
			for(int i=0;i<x;i++)
			{
				if(even)
				{
					goal[i][j] = 1;
					goal[i][j+1]=1;
					even=false;
				}
				else
				{
					even=true;
				}
			}
			if(checker)
				even = (even ? false:true);
		}
		
		**/
//		name = new String("Checkerboard");		
//		boolean even = checker;
//		goal = new int[x][y];
//		for (int j=0;j<y;j++)
//		{
//			for(int i=0;i<x;i++)
//			{
//				if(even)
//				{
//					goal[i][j] = 1;
//					even = false;
//				}
//				else
//				{
//					even = true;
//				}
//			}
//			if(checker)
//				even = (even ? false:true);
//		}
		/**name = new String("2 by 2 blocks separated by 2 white spaces");
		goal = new int[x][y];
		for (int j=0;j<y;j=j+4)
		{
			for(int i=0;i<x;i=i+4)
			{
				
					goal[i][j] = 1;
					goal[i][j+1]=1;
					goal[i+1][j]=1;
					goal[i+1][j+1]=1;
			}
		}
		**/
		/**
		name = new String("Big Plus");
		int xStart = (x/2)-6;
		int xEnd = (x/2)+6;
		int yStart = (y/2)-6;
		int yEnd = (y/2)+6;
		goal = new int[x][y];
		for (int j=0;j<y;j++)
		{
			for(int i=xStart;i<xEnd;i++)
			{
				goal[i][j] = 1;
			}
		}
		
		for (int i=0;i<x;i++)
		{
			for(int j=yStart;j<yEnd;j++)
			{
				goal[i][j] = 1;
			}
		}
		**/
/** Double repeating lines 
		goal = new int[x][y];
		for (int j=0;j<y;j++)
		{
			for(int i=0;i<x;i=i+4)
			{
				
					goal[i][j] = 1;
					goal[i+1][j]=1;
			}
		}
		**/
//		Generates a line pattern with checker = false	
//		boolean even = checker;
//		goal = new int[x][y];
//		for (int j=0;j<y;j++)
//		{
//			for(int i=0;i<x;i++)
//			{
//				if(even)
//				{
//					goal[i][j] = 1;
//					even = false;
//				}
//				else
//				{
//					even = true;
//				}
//			}
//			if(checker)
//				even = (even ? false:true);
//		}
		/**
		int xStart = (x/2)-6;
		int xEnd = (x/2)+6;
		goal = new int[x][y];
		for (int j=0;j<y;j++)
		{
			for(int i=xStart;i<xEnd;i++)
			{
				goal[i][j] = 1;
			}
		}**/
		goalGrid.updateDisplaly(goal);
	}
	public int compare(EvolvedPopulation evolved)
	{
		int comparison=0;
		int black=0;
		int white=0;
		for( int i=0;i<evolved.getXSize();i++)
		{
			for(int j=0;j<evolved.getYSize();j++)
			{
				if(evolved.get(i, j) == goal[i][j])
					comparison++;
				else
					comparison--;

			}
		}
		return comparison;
	}

}
